We are migrating the bug tracker to github Issues. This is now the preferred way to report NASM bugs.
Self-registration is disabled due to spam issue (mail gorcunov@gmail.com or hpa@zytor.com to create an account)
Expectation: All cases should work and display bar or qux. Actual result: If a context-local define is defined to the empty token, and then we attempt to re-define it using either %define or %xdefine in which we build the define name using macro indirection %[...], it fails with "error: `%xdefine' expects a macro identifier". The same for a non-context-local smacro define works as expected. Test case: test$ nasm -v NASM version 2.16.02rc2 compiled on Oct 12 2023 test$ cat test.asm %assign slot 26 %push %ifdef INIT %define %$entry26 %define entry26 %endif %define foo bar %ifdef A %define %$entry%[slot] foo %elifdef B %xdefine %$entry%[slot] foo %elifdef C %define entry%[slot] foo %elifdef D %xdefine entry%[slot] foo %endif %define foo qux %fatal %$entry26 entry26 test$ nasm test.asm -DA test.asm:20: fatal: qux entry26 test$ nasm test.asm -DB test.asm:20: fatal: bar entry26 test$ nasm test.asm -DC test.asm:20: fatal: %$entry26 qux test$ nasm test.asm -DD test.asm:20: fatal: %$entry26 bar test$ nasm test.asm -DINIT -DA test.asm:11: error: `%define' expects a macro identifier test.asm:20: fatal: test$ nasm test.asm -DINIT -DB test.asm:13: error: `%xdefine' expects a macro identifier test.asm:20: fatal: test$ nasm test.asm -DINIT -DC test.asm:20: fatal: qux test$ nasm test.asm -DINIT -DD test.asm:20: fatal: bar test$ I came across this during development of a partitioning script I wrote using NASM, in which I wanted to re-define one of four different context-local variables addressed using a 1 to 4 suffix. I eventually solved this differently which works here because I only needed 4 different conditional branches. The work around code in question is at https://hg.pushbx.org/ecm/bootimg/file/708fd9e7617a/partdisk.asm#l427